<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>充值</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.min.js"></script>
    <script src="../../js/env.js"></script>
    <script src="../../js/jQuery.md5.js"></script>
    <script>
        if(layui.sessionData('user').userInfo===undefined){
            window.location.href = "../login.html"
        }
    </script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title"  >
    <legend id="aaa">充值,扣款</legend>
</fieldset>
<form action="" class="layui-form">

    <div class="layui-form-item">
        <div class="layui-inline" >
            <label class="layui-form-label"><i style="color:red">*</i>&nbsp;卡号</label>
            <div class="layui-input-inline">
                <input name="cardNum" autocomplete="off" class="layui-input" id="cardNum" type="text">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
    <div class="layui-inline"  >
        <label class="layui-form-label">操作</label>
        <div class="layui-input-inline">
            <select id="operation" lay-verify="">
                <option value="0">请选择操作</option>
                <option value="1">充值</option>
                <option value="2">扣款</option>
            </select>
        </div>
    </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label"><i style="color:red">*</i>&nbsp;金额</label>
            <div class="layui-input-inline">
                <input name="money"  autocomplete="off" class="layui-input" id="money" type="text">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label"><i style="color:red">*</i>&nbsp;备注信息</label>
            <div class="layui-input-inline">
                <input name="remark"  autocomplete="off" class="layui-input" id="remark" type="text">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-radius" type="button" onclick="submi()" lay-submit="" lay-filter=""style="background-color: #0092EF;">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius">重置</button>
        </div>
    </div>
</form>

<script>

layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;

});




function submi(){
    if($("#cardNum").val()=="" || $("#cardNum").val()==null){
        layer.msg("请输入卡号！");
        return;
    }
    if($("#operation").val()=="" || $("#operation").val()==null){
        layer.msg("请选择操作！");
        return;
    }
    if($("#money").val()=="" || $("#money").val()==null){
        layer.msg("请输入金额！");
        return;
    }
    if($("#remark").val()=="" || $("#remark").val()==null){
        layer.msg("请输入备注信息！");
        return;
    }


    var requestData = {
        "cardNum": $("#cardNum").val(),
        "operation":$("#operation").val(),
        "money": $("#money").val(),
        "remark": $("#remark").val(),
        "agentUserId":1,
    };
    var responseData = MyAjax("POST", "/agent/stockUser/updateIcRecharge", requestData,getToken())
    if (responseData.code === 0) {
        //缓存用户登录信息
        layui.sessionData('user', {
            key: 'userInfo'
            , value: responseData.data
        });

        window.location.href = "../IC.html"
    }



}
</script>
</body>

</html>
